import requests
response = requests.get('http://www.baidu.com')
# print(response.text)
# print(response.headers)
# print(response.status_code)# 获取状态码
# print(response.cookies)
# b站图片截取下载
# response = requests.get('https://i0.hdslb.com/bfs/archive/4cdfd0305e52a33236abc896cdd2ab363cbf3c52.png@1100w_484h_1c_100q.png')
# with open('1.png', 'wb') as f:
#     f.write(response.content) # 打印二进制
#     f.close()
# 知乎内容提取
headers = {
    'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36'
}
res = requests.get('https://www.zhihu.com/question/368940464/answer/993099482', headers=headers)
# print(res.text)
# print(res.status_code)
# print(res.cookies)
# print(res.url)
# print(res.history)
# 获取cookies
print(res.cookies)
s = requests.Session()
s.get('https://www.zhihu.com/question/368940464/answer/993099482')
